package com.neu.servlet.klz;

import com.neu.service.klz.Addservice;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.List;
import java.util.Map;

@WebServlet(name = "AdderssServlet", urlPatterns = {"/AddressServlet.do"})
public class AdderssServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Map map=(Map)request.getSession().getAttribute("user");
        String id= (String) map.get("U_ID");
        System.out.println(id);
        Addservice addservice=new Addservice();
        List<Map<String,Object>> list=addservice.dofindById(id);
        HttpSession session=request.getSession();
        session.setAttribute("address",list);
        System.out.println(list);
//        request.getRequestDispatcher("WEB-INF/views/car.jsp").forward(request,response);
        //${sessionscope.address}

    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
